package com.leshua.channel.mpos.service.lepos.impl;

import com.leshua.channel.mpos.mapper.lepos.PinpadIndustryMapper;
import com.leshua.channel.mpos.model.lepos.PinpadIndustry;
import com.leshua.channel.mpos.model.lepos.PinpadIndustryExample;
import com.leshua.channel.mpos.service.lepos.PinpadIndustryService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.List;


/**
 * @author Devlin
 */
@Service
public class PinpadIndustryServiceImpl implements PinpadIndustryService {

    @Resource
    private PinpadIndustryMapper pinpadIndustryMapper;

    @Override
    public PinpadIndustry queryByCode(String code) {
        PinpadIndustryExample example = new PinpadIndustryExample();
        example.setOrderByClause("F_create_time desc");
        PinpadIndustryExample.Criteria criteria = example.createCriteria();
        criteria.andCodeEqualTo(code);
        List<PinpadIndustry> industryList = pinpadIndustryMapper.selectByExample(example);
        return CollectionUtils.isEmpty(industryList) ? null : industryList.get(0);
    }
}
